package sctu.edu.java.year2016.team08.chenruixiu.day20160521.chapter5_2;

/**编写Java程序，创建一维数组arr[],将数组中最大的数输出
 * Created by Administrator on 2016/5/21.
 */
public class Two {
    public static void main(String[] args) {
        int arr[] = new int[]{1, 3, 5, 7, 9, 10};
        System.out.println("输出一位数组：");
        for (int i = 0; i < arr.length; i++) {
            System.out.print(arr[i] + " ");
        }
        int max = arr[0];
        for (int j = 0; j < arr.length - 1; j++) {
            if (max < arr[j + 1])
                max = arr[j + 1];

        }
        System.out.println("一维数组的最大值是：" + max);
    }

}


